package main

import "fmt"

/*
单向管道
*/
func main() {
	//1、默认情况： 双向管道
	ch1 := make(chan int, 2)
	ch1 <- 10
	ch1 <- 12
	m1 := <-ch1
	m2 := <-ch1
	fmt.Println(m1, m2)

	//2、声明只写管道
	ch2 := make(chan<- int, 2)
	ch2 <- 20
	ch2 <- 22
	// <-ch2 //cannot receive from send-only channel ch2

	//3、声明只读管道
	ch3 := make(<-chan int, 3)
	// ch3 <- 23 //cannot send to receive-only channel ch3

}
